import SwiftUI

struct CatalogView: View {
    var body: some View {
        NavigationStack {
            List {
                // Content View
                NavigationLink {
                    ContentView()
                } label: {
                    // 链接的界面
                     ListRowItem(iconName: "text.below.photo", label: "Content View")
                }
                
                NavigationLink {
                    HStackView()
                } label: {
                    // 链接的界面
                    ListRowItem(iconName: "square.stack.3d.forward.dottedline", label: "HStackView")
                }
                
                NavigationLink {
                    VStackDemo()
                } label: {
                    // 链接的界面
                    ListRowItem(iconName: "square.3.layers.3d.top.filled", label: "VStackDemo")
                }
                
                // 简单跳转链接
                // NavigationLink("Go to ZStackDemo", destination: ZStackDemo())
                
                // 自定义界面跳转链接
                NavigationLink {
                    ZStackDemo()
                } label: {
                    // 链接的界面
                    ListRowItem(iconName: "square.stack.3d.down.right", label: "ZStackDemo")
                }
                
                /// Homework
                // 把 PullInBehavior, VStack1206 这两个界面加入到 Catalog
            }
            .navigationTitle("Catalog")
        }
    }
}

struct ListRowItem: View {
    let iconName: String
    let label: String
    
    var body: some View {
        HStack {
            // 图标
            Image(systemName: iconName)
            // 标题
            Text(label)
        }
    }
}

struct DemoView: View {
    var body: some View {
        HStack {
            Button(action: {
                
            }, label: {
                Text("Top leading")
            })
            
        }
    }
}
